#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2021/4/19 下午2:31
# @Author  : fugang_le
# @Software: PyCharm


######################################### 多线程的使用 #########################################
import threading


class myThread(threading.Thread):
    def __init__(self, threadID, name, counter):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.counter = counter
    def run(self):
        # print(self.counter)
        return self.counter * 10



threads = []
for i in range(100):
    # 创建新线程
    threads.append(myThread(i, "Thread-"+str(i), i))

for t in threads:
    # 开启新线程
    t.start()
result = []
for t in threads:
    t.join()
    result.append(t.run())
print(result)
print("退出主线程")
